package com.wisely.xxboot.dao;

import com.wisely.xxboot.domain.MongoPerson;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.List;

/**
 * <p>Description:</p>
 * <p>Copyright: Copyright (c) 2017</p>
 * <p>Company: 中视数讯</p>
 * <p>Site: www.digi-zones.com</p>
 *
 * @author shengping
 * @version 1.0
 * @date 2017/7/3
 */

public interface MongoPersonRepository extends MongoRepository<MongoPerson, String>
{
    MongoPerson findByName(String name); //1支持方法名查询

    @Query("{'age':?0}")//2支持@Query查询，查询参数构造JSON字符串即可
    List<MongoPerson> withQueryFindByAge(Integer age);

}
